package apps.softtech.Model;

import android.content.ContentValues;
import android.database.Cursor;

public class Report {
	public int getReportId() {
		return reportId;
	}
	public void setReportId(int reportId) {
		this.reportId = reportId;
	}
	public int getObjectType() {
		return objectType;
	}
	public void setObjectType(int objectType) {
		this.objectType = objectType;
	}
	public int getObjectId() {
		return objectId;
	}
	public void setObjectId(int objectId) {
		this.objectId = objectId;
	}
	public String getCreatedDate() {
		return createdDate;
	}
	public void setCreatedDate(String createdDate) {
		this.createdDate = createdDate;
	}
	public int getUserId() {
		return userId;
	}
	public void setUserId(int userId) {
		this.userId = userId;
	}
	public static final String TABLE_NAME = "Report";

	public static final String REPORT_ID = "st_ReportId";
	private int reportId;

	public static final String OBJECT_TYPE = "st_ObjectType";
	private int objectType;

	public static final String OBJECT_ID = "st_ObjectId";
	private int objectId;

	public static final String CREATED_DATE = "st_CreatedDate";
	private String createdDate;

	public static final String USERID = "st_UserId";
	private int userId;
	
	public Report() {
		super();
	}
	public Report(int reportId, int objectType, int objectId,
			String createdDate, int userId) {
		super();
		this.reportId = reportId;
		this.objectType = objectType;
		this.objectId = objectId;
		this.createdDate = createdDate;
		this.userId = userId;
	}
	public Report(int objectType, int objectId, String createdDate, int userId) {
		super();
		this.objectType = objectType;
		this.objectId = objectId;
		this.createdDate = createdDate;
		this.userId = userId;
	}

	/**
	 * get value of Report
	 * @author MUI
	 * @return ContentValues
	 */
	public ContentValues getValueReport(){
		ContentValues values = new ContentValues();
		values.put(USERID, this.getUserId());
		values.put(OBJECT_TYPE, this.getObjectType());
		values.put(OBJECT_ID, this.getObjectId());
		values.put(CREATED_DATE, this.getCreatedDate());
		return values;
	}
	public void setValueFromCursor(Cursor c) {

		if(c.getColumnIndex(REPORT_ID)>=0){
			setReportId(c.getInt(c.getColumnIndex(REPORT_ID)));
		}
		if(c.getColumnIndex(CREATED_DATE)>=0){
			setCreatedDate(c.getString(c.getColumnIndex(CREATED_DATE)));
		}
		if(c.getColumnIndex(OBJECT_ID)>=0){
			setObjectId(c.getInt(c.getColumnIndex(OBJECT_ID)));
		}
		if(c.getColumnIndex(OBJECT_TYPE)>=0){
			setObjectType(c.getInt(c.getColumnIndex(OBJECT_TYPE)));
		}
		if(c.getColumnIndex(USERID)>=0){
			setUserId(c.getInt(c.getColumnIndex(USERID)));
		}
	}
	
}
